import asyncio
from playwright.async_api import async_playwright


async def main():
    async with async_playwright() as p:
        # headless = False : 是否启动无头模式，无头模式是不弹出浏览器，后台运行
        browser = await p.chromium.launch(headless=False)
        page = await browser.new_page()
        await page.goto('https://www.baidu.com')
        print(await page.title())

        await browser.close()

asyncio.run(main())
